<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="site" value="noticeList" scope="application"/>
<html>
	<jsp:include page="module/jsp/head.jsp"/>
	<body >
		<c:import url="module/jsp/header.jsp"/>
		<c:import url="module/jsp/aside.jsp"/>
		<main>
			<div class="main-content">
				<div class="welcome">您现在的位置是：首页>公告</div>
				<div class="newsbox">
					<section style="width: 100%;">
						<div class="news">
							<h2 class="newstitle"><b>公告</b></h2>
							<ul>
								<c:forEach var="notice" items="${page.records}">
									<li>
										<a target="_blank" href="${pageContext.request.contextPath}/notice?id=${notice.id}">
											<span>
												<jsp:useBean id="timestamp" class="java.util.Date"/>
												<jsp:setProperty name="timestamp" property="time" value="${notice.gmtCreate *1000}"/>
												<fmt:formatDate value="${timestamp}" pattern="yyyy-MM-dd"/>
											</span>
											${notice.title}
										</a>
									</li>
								</c:forEach>
							</ul>
						</div>
					</section>
				</div>
				<div class="pagelist">
					<a title="Total record">&nbsp<b>总记录：${page.total}</b></a>&nbsp;&nbsp;

					<c:if test="${page.current gt 1}">
						<a>首页</a>&nbsp;
					</c:if>

					<c:if test="${page.current gt 1}">
						<a>上一页</a>
					</c:if>

					<c:if test="${page.current > 2} ">
						<c:forEach var="x" begin="${page.current-2}" end="${page.current}">
							<a href="${pageContext.request.contextPath}/list?page=${x}">${x}</a>
						</c:forEach>
					</c:if>
					<b>${page.current}</b>
					<c:if test="${page.current < page.total/page.size - 2} ">
						<c:forEach var="x" begin="${page.current}" end="${page.current + 2}">
							<a href="${pageContext.request.contextPath}/list?page=${x}">${x}</a>
						</c:forEach>
					</c:if>
					<c:if test="${page.total/page.size gt page.current}">
						<a>下一页</a>&nbsp;
					</c:if>

					<c:if test="${page.current lt page.total/page.size}">
						<a>尾页</a>
					</c:if>
				</div>
				<jsp:include page="module/jsp/footer.jsp"/>
			</div>
		</main>
		<a href="#" class="cd-top cd-is-visible">Top</a>
	</body>
	<jsp:include page="module/jsp/js.jsp"/>
</html>
